/**
 * Created by Administrator on 2018/1/29.
 */
DO_PAY = {};
DO_PAY.__INIT__ = function (code, fee) {
    DO_PAY.do_pay_view(code, fee);
};
DO_PAY.__INIT__recharge = function (code, fee) {
    /**
     * 禁止余额付款
     */
    DO_PAY.do_pay_view(code, fee, 1);
};
//支付页面
DO_PAY.do_pay_view = function (code, fee, e) {

    /**
     * 支付插件
     */
    use("tool/pay");
    use("tool/yue/yue");

    var ua = navigator.userAgent;
    var isWeixin = !!/MicroMessenger/i.test(ua);
    var i_data = [];
    if (isWeixin) {
        i_data.push({
            "action": "wxpay_hao('" + code + "')",
            "payment_type": "公众号支付",
            "color": "color_gongzhonghao"
        });
    }
    if (window.plus) {
        i_data.push({
            "action": "alipay_('" + code + "','" + fee + "')",
            "payment_type": "支付宝",
            "color": "color_aliPay"
        });
        i_data.push({
            "action": "wxpay_('" + code + "','" + fee + "')",
            "payment_type": "微信支付",
            "color": "color_wxPay"
        });
    }
    if (!e) {
        i_data.push({
            "action": "YUE.is_set_pwd(DO_PAY.payment_shop,'" + code + "')",
            "payment_type": "余额支付",
            "color": "color_yuePay"
        });
    }
    fee = parseFloat(fee).toFixed(2);
    mainView.router.load({
        url: "src/index/pay/pay.html",
        context: {
            "data": i_data,
            "fee": fee
        }
    });
}
DO_PAY.payment_shop = function (code, pwd) {
    request_(
        url_('api/V3/do_yue'),
        {
            code: code,
            password: pwd
        }, function (d) {
            if (d.code == 0) {
                my_tips_("支付成功",function(){
                	go_href_('#/order_list/0')
                })
            } else {
                my_tips_(d.msg)
            }
        }
    );
}